package com.jani.platform.test.service.impl;

import com.jani.platform.core.annotation.DataSource;
import com.jani.platform.core.enums.DataSourceType;
import com.jani.platform.test.mapper.UserMapper;
import com.jani.platform.test.model.User;
import com.jani.platform.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User selectById(String id) {
        return userMapper.selectById(id);
    }

    @Override
    @DataSource(value = DataSourceType.SLAVE)
    public List<User> selectAll() {
        return userMapper.selectAll();
    }
}
